package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("in")
    public void insertOne(User user) {
        userService.insertOne(user);
    }

    @RequestMapping("del")
    public void deleteOne(Integer id) {
        userService.deleteOne(id);
    }

    @RequestMapping("up")
    public void updateOne(String name, Integer id) {
        userService.updateOne(name,id);
    }

     @RequestMapping("list")
    public List<User> selectList() {
        return userService.selectList();
    }
}
